home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg3.cab / master_usability_links.xsl < prev    next >
Extensible Markup Language  |  2005-09-10  |  9KB  |  231 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.     OpenOffice.org - a multi-platform office productivity suite
  5.  
  6.     $RCSfile: master_usability_links.xsl,v $
  7.  
  8.     $Revision: 1.6 $
  9.  
  10.     last change: $Author: rt $ $Date: 2005/09/08 22:09:39 $
  11.  
  12.     The Contents of this file are made available subject to
  13.     the terms of GNU Lesser General Public License Version 2.1.
  14.  
  15.  
  16.       GNU Lesser General Public License Version 2.1
  17.       =============================================
  18.       Copyright 2005 by Sun Microsystems, Inc.
  19.       901 San Antonio Road, Palo Alto, CA 94303, USA
  20.  
  21.       This library is free software; you can redistribute it and/or
  22.       modify it under the terms of the GNU Lesser General Public
  23.       License version 2.1, as published by the Free Software Foundation.
  24.  
  25.       This library is distributed in the hope that it will be useful,
  26.       but WITHOUT ANY WARRANTY; without even the implied warranty of
  27.       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  28.       Lesser General Public License for more details.
  29.  
  30.       You should have received a copy of the GNU Lesser General Public
  31.       License along with this library; if not, write to the Free Software
  32.       Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  33.       MA  02111-1307  USA
  34.  
  35. -->
  36. <!--
  37.     For further documentation and updates visit http://xml.openoffice.org/sx2ml
  38. -->
  39. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  40.         xmlns:office="http://openoffice.org/2000/office"
  41.         xmlns:style="http://openoffice.org/2000/style"
  42.         xmlns:text="http://openoffice.org/2000/text"
  43.         xmlns:table="http://openoffice.org/2000/table"
  44.         xmlns:draw="http://openoffice.org/2000/drawing"
  45.         xmlns:fo="http://www.w3.org/1999/XSL/Format"
  46.         xmlns:xlink="http://www.w3.org/1999/xlink"
  47.         xmlns:number="http://openoffice.org/2000/datastyle"
  48.         xmlns:svg="http://www.w3.org/2000/svg"
  49.         xmlns:chart="http://openoffice.org/2000/chart"
  50.         xmlns:dr3d="http://openoffice.org/2000/dr3d"
  51.         xmlns:math="http://www.w3.org/1998/Math/MathML"
  52.         xmlns:form="http://openoffice.org/2000/form"
  53.         xmlns:script="http://openoffice.org/2000/script"
  54.         xmlns:dc="http://purl.org/dc/elements/1.1/"
  55.         xmlns:meta="http://openoffice.org/2000/meta"
  56.         xmlns:config="http://openoffice.org/2001/config"
  57.         xmlns:help="http://openoffice.org/2000/help"
  58.         xmlns:sxg="http://www.jclark.com/xt/java/org.openoffice.xslt.OOoMasterDocument"
  59.         xmlns:java="http://xml.apache.org/xslt/java"
  60.         xmlns="http://www.w3.org/1999/xhtml"
  61.         version="1.0"
  62.         exclude-result-prefixes="office style text table draw fo xlink number svg chart dr3d math form script dc meta config help java sxg">
  63.  
  64.  
  65.     <!-- ******************************************************************************************************* -->
  66.     <!-- ***  Creation of a line of links at the beginning and end of a child document to enhance usability  *** -->
  67.     <!-- ******************************************************************************************************* -->
  68.  
  69.     <xsl:template name="add-child-document-usability-links">
  70.         <xsl:if test="$contentTableHeadings">
  71.         <p style="text-align:center;">
  72.             <xsl:element name="small">
  73.                 <xsl:text>[ </xsl:text>
  74.                 <xsl:variable name="currentChildNo" select="number($contentTableHeadings/heading[$currentChildContentRef = @file-url]/@child-document-no)" />
  75.                 <xsl:variable name="earlierDocURL" select="$contentTableHeadings/heading[($currentChildNo - 1) = @child-document-no]/@out-file-url" />
  76. <!--
  77. NOTE: add character entity CR - enable debugvariable -->
  78.                 <xsl:if test="$debugEnabled">
  79.                     <xsl:if test="$currentChildContentRef">
  80.                         <xsl:message>
  81.                             <xsl:text>
  82.  
  83. currentChildContentRef:
  84. </xsl:text>
  85.                             <xsl:value-of select="$currentChildContentRef" />
  86.                             <xsl:text>
  87.  
  88. </xsl:text>
  89.  
  90.                         </xsl:message>
  91.                     </xsl:if>
  92.                     <xsl:if test="$earlierDocURL">
  93.                         <xsl:message>
  94.                             <xsl:text>
  95.  
  96. earlierDoc:
  97. </xsl:text>
  98.                             <xsl:value-of select="$earlierDocURL" />
  99.                             <xsl:text>
  100.  
  101. </xsl:text>
  102.  
  103.                         </xsl:message>
  104.                     </xsl:if>
  105.                     <xsl:message>
  106.                         <xsl:text>
  107.  
  108. FinalRef:
  109. </xsl:text>
  110.                         <xsl:call-template name="get-relative-u-r-l-between-master-children">
  111.                             <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  112.                             <xsl:with-param name="toChildFileRef" select="$earlierDocURL" />
  113.                         </xsl:call-template>
  114.                         <xsl:text>
  115.  
  116. </xsl:text>
  117.                     </xsl:message>
  118.                 </xsl:if>
  119.                 <xsl:if test="$earlierDocURL">
  120.                     <xsl:element name="a">
  121.                         <xsl:attribute name="href">
  122.                             <!-- when the links starts with a '#' it's a link to the Content Table-->
  123.                             <xsl:choose>
  124.                                 <xsl:when test="starts-with($earlierDocURL, '#')">
  125.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  126.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  127.                                         <xsl:with-param name="toChildFileRef" select="." />
  128.                                     </xsl:call-template>
  129.  
  130.                                 </xsl:when>
  131.                                 <xsl:otherwise>
  132.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  133.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  134.                                         <xsl:with-param name="toChildFileRef" select="$earlierDocURL" />
  135.                                     </xsl:call-template>
  136.                                 </xsl:otherwise>
  137.                             </xsl:choose>
  138.                         </xsl:attribute>
  139.                         <xsl:attribute name="title">Link to previous document</xsl:attribute>
  140.                         <xsl:text>Previous document</xsl:text>
  141.                     </xsl:element>
  142.  
  143.                     <xsl:text> | </xsl:text>
  144.                 </xsl:if>
  145.                 <xsl:element name="a">
  146.                     <xsl:attribute name="href">
  147.                         <!-- when currentChildContentRef is unset the current file is the Content Table-->
  148.                         <xsl:choose>
  149.                             <xsl:when test="$currentChildContentRef">
  150.                                 <xsl:call-template name="get-relative-content-table-u-r-l">
  151.                                     <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  152.                                 </xsl:call-template>
  153.                             </xsl:when>
  154.                             <xsl:otherwise>
  155.                                 <xsl:text>#</xsl:text>
  156.                             </xsl:otherwise>
  157.                         </xsl:choose>
  158.                     </xsl:attribute>
  159.                     <xsl:attribute name="title">Link to the Content Table</xsl:attribute>
  160.                     <xsl:text>Content Table</xsl:text>
  161.                 </xsl:element>
  162.  
  163.  
  164.                 <xsl:variable name="nextDocURL" select="$contentTableHeadings/heading[($currentChildNo + 1) = @child-document-no]/@out-file-url" />
  165.                 <xsl:if test="$nextDocURL">
  166.                     <xsl:text> | </xsl:text>
  167.                     <xsl:element name="a">
  168.                         <xsl:attribute name="href">
  169.                             <!-- when the links starts with a '#' it's a link to the Content Table-->
  170.                             <xsl:choose>
  171.                                 <xsl:when test="starts-with($nextDocURL, '#')">
  172.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  173.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  174.                                         <xsl:with-param name="toChildFileRef" select="." />
  175.                                     </xsl:call-template>
  176.                                 </xsl:when>
  177.                                 <xsl:otherwise>
  178.                                     <xsl:call-template name="get-relative-u-r-l-between-master-children">
  179.                                         <xsl:with-param name="fromChildFileRef" select="$currentChildContentRef" />
  180.                                         <xsl:with-param name="toChildFileRef" select="$nextDocURL" />
  181.                                     </xsl:call-template>
  182.                                 </xsl:otherwise>
  183.                             </xsl:choose>
  184.                         </xsl:attribute>
  185.                         <xsl:attribute name="title">Link to next document</xsl:attribute>
  186.                         <xsl:text>Next document</xsl:text>
  187.                     </xsl:element>
  188.                 </xsl:if>
  189.                 <xsl:text> ]</xsl:text>
  190.             </xsl:element>
  191.         </p>
  192.         </xsl:if>
  193.     </xsl:template>
  194.  
  195.  
  196.     <xsl:template name="get-relative-u-r-l-between-master-children">
  197.         <xsl:param name="fromChildFileRef" />
  198.         <xsl:param name="toChildFileRef" />
  199.  
  200.         <xsl:choose>
  201.             <xsl:when test="function-available('sxg:get-relative-u-r-l-between-master-children')">
  202.                 <xsl:value-of select="sxg:get-relative-u-r-l-between-master-children(string($fromChildFileRef), string($toChildFileRef))" />
  203.             </xsl:when>
  204.             <xsl:when test="function-available('java:org.openoffice.xslt.OOoMasterDocument.getRelativeURLBetweenMasterChildren')">
  205.                 <xsl:value-of select="java:org.openoffice.xslt.OOoMasterDocument.getRelativeURLBetweenMasterChildren(string($fromChildFileRef), string($toChildFileRef))" />
  206.             </xsl:when>
  207.             <xsl:otherwise>
  208.                 <xsl:message terminate="yes">ERROR: Function not found: java:org.openoffice.xslt.OOoMasterDocument.getRelativeURLBetweenMasterChildren</xsl:message>
  209.             </xsl:otherwise>
  210.         </xsl:choose>
  211.     </xsl:template>
  212.  
  213.  
  214.     <xsl:template name="get-relative-content-table-u-r-l">
  215.         <xsl:param name="fromChildFileRef" />
  216.  
  217.         <xsl:choose>
  218.             <xsl:when test="function-available('sxg:get-relative-content-table-u-r-l')">
  219.                 <xsl:value-of select="sxg:get-relative-content-table-u-r-l(string($fromChildFileRef))" />
  220.             </xsl:when>
  221.             <xsl:when test="function-available('java:org.openoffice.xslt.OOoMasterDocument.getRelativeContentTableURL')">
  222.                 <xsl:value-of select="java:org.openoffice.xslt.OOoMasterDocument.getRelativeContentTableURL(string($fromChildFileRef))" />
  223.             </xsl:when>
  224.             <xsl:otherwise>
  225.                 <xsl:message terminate="yes">ERROR: Function not found: java:org.openoffice.xslt.OOoMasterDocument.getRelativeContentTableURL</xsl:message>
  226.             </xsl:otherwise>
  227.         </xsl:choose>
  228.     </xsl:template>
  229.  
  230. </xsl:stylesheet>
  231.